package com.example.myapplication.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

import com.example.myapplication.shortvideo.utils.DisplayUtils;

public class MicMuteBgView extends View {
    private Paint mPaint;

    public MicMuteBgView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mPaint = new Paint();
        setAlpha(0.4f);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        mPaint.setAntiAlias(true);//取消锯齿
        mPaint.setStyle(Paint.Style.FILL);
        mPaint.setStrokeWidth(0);
        mPaint.setColor(Color.parseColor("#000000"));
        int r = getWidth();
        RectF oval = new RectF(0, -r / 2-1,
                r, r / 2 + 1);
        RectF oval2 = new RectF(0, DisplayUtils.dp2px(5),
                r, r+1);
        canvas.drawArc(oval, 35, 110, false, mPaint);//画圆弧，这个时候，绘制没有经过圆心
        canvas.drawArc(oval2, 215, 110, false, mPaint);//画圆弧，这个时候，绘制没有经过圆心

    }
}